package com.chinamobile.iot.mqtt.spi.model;


/**
 * the saved message save at redis #DATA_clientId
 * Created by szl on 2017/7/5.
 */
public class Qos1Message {
    /**
     * the message publish failed or not ack in 10 second
     */
    private StoredMessage data;
    /**
     * the client who should recive the publish message
     */
    private String toClientId;
    /**
     * the messageId
     */
    private int msgId;
    /**
     * the round of this data saved in redis
     */
    private int round;

    public StoredMessage getData() {
        return data;
    }

    public void setData(StoredMessage data) {
        this.data = data;
    }

    public String getToClientId() {
        return toClientId;
    }

    public void setToClientId(String toClientId) {
        this.toClientId = toClientId;
    }

    public int getMsgId() {
        return msgId;
    }

    public void setMsgId(int msgId) {
        this.msgId = msgId;
    }

    public int getRound() {
        return round;
    }

    public void setRound(int round) {
        this.round = round;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        Qos1Message that = (Qos1Message) o;

        if (msgId != that.msgId) return false;
        return toClientId.equals(that.toClientId);
    }

    @Override
    public int hashCode() {
        int result = toClientId.hashCode();
        result = 31 * result + msgId;
        return result;
    }
}
